<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<title>组织表单</title>
		<div th:replace="/common/common_form_header"></div>
		
	</head>
	<body>
	<div class="layui-tab-content">
		<form id="defaultForm"  action="#" th:method="post" th:action="@{/system/data-dic/update}" class="container-fluid">
			<input type="hidden" id="id" name="id" th:value="${sysDataDic.id}" >
				<div class="row">
		    		<div class="floor-msg">
		    			<div class="form-modal">
							<div class="form-wrap clearfix">
								<div class="col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
									    <label for="">类型</label>
									    <select id="dicType" name="dicType" class="form-control selectpicker">
									   	</select>
									</div>
								</div>
								<div class="col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
									    <label for="">字典名称</label>
									    <input type="text" name="dicName" id="dicName" class="form-control" th:value="${sysDataDic.dicName}"/>
									</div>
								</div>
								<div class="col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
									    <label for="">排序号</label>
									    <input type="text" name="sortNumber" id="sortNumber" class="form-control" th:value="${sysDataDic.sortNumber}">
									</div>
								</div>
								
							 	<div class="col-md-6 col-sm-6 col-xs-6">
									<button type="button" class="btn btn-default float-r" onclick="closeLayer()">取消</button>
								</div>	
								<div class="col-md-6 col-sm-6 col-xs-6">
									<button type="submit" class="btn btn-primary">保存</button>
								</div>
							</div>
						</div>
		    		</div>
		    	</div>
	      </form>
	</div>
</body>
<script src="/js/common.js"></script>
<script th:inline="javascript">
	$(document).ready(function() {
		initSelect("dicType","/system/data-dic-type/selectjson",/*[[${sysDataDic.dicType}]]*/);
	});
</script>
<script type="text/javascript" th:inline="javascript">
$(document).ready(function() {
    $('#defaultForm')
        .bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
            	dicName: {
                    message: 'The dicName is not valid',
                    validators: {
                        notEmpty: {
                            message: 'The dicName is required and can\'t be empty'
                        }
                    }
                }
            }
        })
        .on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();

            // Get the form instance
            var $form = $(e.target);

            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');

            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function(result) {
				parent.layer.closeAll();
				parent.layer.msg(result.msg);
				parent.layui.table.reload('testReload');
            }, 'json');
            //alert($form.attr('action'));
            
        });
});
</script>	
	
</html>